<div class="layui-card-body" style="min-width: 600px;min-height: 600px;">

        <div class="layui-tab" lay-filter="tabmain">
            <ul class="layui-tab-title">
                <li class="layui-this" lay-id="21">设置</li>
                <li lay-id="22">订购历史</li>

            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <table class="layui-table text-center" id="list21" lay-filter="list21"
                           list-url="{:url('customer/product/productlists?uid='.$id)}"
                    ></table>
                </div>
                <div class="layui-tab-item">
                    <table class="layui-table text-center" id="list22" lay-filter="list22"
                           list-url="{:url('customer/product/outorderlists?uid='.$id)}"
                    ></table>
                </div>

            </div>
        </div>

</div>

<script type="text/javascript">
    layui.use(['element', 'form', 'layer', 'table', 'code'], function () {
        var form = layui.form
            , table = layui.table
            , $ = layui.$
            , element = layui.element
            , code = layui.code
            , laydate = layui.laydate;

        element.on('tab(tabmain)', function (data) {
            if (this.getAttribute('lay-id') == 22) {
                table.reload('list22', {
                    url: "{:Url('customer/product/outorderlists?uid='.$id)}"
                    , where: {} //设定异步数据接口的额外参数
                    //,height: 300
                });
            }
            if (this.getAttribute('lay-id') == 21) {
                table.reload('list21', {
                    url: "{:url('customer/product/lists?uid='.$id)}"
                    , where: {} //设定异步数据接口的额外参数
                    //,height: 300
                });
            }
        });
        table.render({
            elem: '#list21'
            , url: "{:url('customer/product/lists?uid='.$id)}"
            , page: true
            , limit: 10
            , cols: [[
                {field: 'title', width: 150, title: '项目名称'}
                , {field: 's_time', width: 110, title: '开始时间'}
                , {field: 'e_time', width: 110, title: '结束时间'}
                , {field: 'status', width: 70, title: '状态'}
                , {field: 'sys_info', title: '系统备注'}
            ]]
        });
        table.render({
            elem: '#list22'
            , url: "{:Url('customer/product/outorderlists?uid='.$id)}"
            , page: true
            , limit: 10
            , cols: [[
                {field: 'order_id', width: 175, title: '订单号'}
                , {field: 'c_time', width: 190, title: '下单时间'}
                , {field: 'price', width: 100, title: '支付价格', align: 'right'}
                , {field: 'status', width: 90, title: '订单状态'}
            ]]
        });


    });

</script>






